/*
*

	@author: taco
	@Date: 2022/6/6
	@Time: 14:42

*
*/
package utils

import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/hex"
)

func HmacSha256(data string, secret string) string {
	key := []byte(secret)
	h := hmac.New(sha256.New, key)
	h.Write([]byte(data))
	//	fmt.Println(h.Sum(nil))
	//	fmt.Println(sha)

	//	hex.EncodeToString(h.Sum(nil))
	return hex.EncodeToString(h.Sum(nil))
}
